<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>3614：[Heoi2014]逻辑翻译</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Heoi2014]逻辑翻译</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Heoi2014]逻辑翻译</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Heoi2014]逻辑翻译                </h1>
                <p>时间限制：50s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：16MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div>在人类的神经系统中，每个信号都可以用?1或+1来表示。这些信号组合起来最后形成 了喜怒哀乐，酸甜苦辣，红黄绿蓝等各种各样的复杂信息。纳米探测科技的突破让生物学家 可以测量大脑中特定区域的完整逻辑功能。然而超大数据的处理一直是令 H 教授头疼的问 题。</div>
<div>&nbsp;假设一个逻辑单元接受N个信号输入，并产生一个代表某种意义的实数值r。那么总共 可能的情况有2^N种。</div>
<div>通过长时间的累积测量， H 教授可以准确地获得输入信号与r的关系表：</div>
<div>&nbsp;f:{-1,1}N &rarr;R &nbsp;然而进一步研究发现，神经元的运算方式可以被建模为人们熟知的多项式。由于一个输 入</div>
<div>信号值的平方一定为1，所以我们可以用不含幂的2^N项的多项式来唯一表示任何一个逻辑f。&nbsp;</div>
<div>&nbsp;例如</div>
<div>&nbsp;x1 = +1; x2 = +1 &nbsp; x1 = +1; x2 = -1 &nbsp;x1 = -1; x2 = +1 x1 = -1; x2 = -1</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 &nbsp;</div>
<div>可以写成 f(x1,x2) = 1.5 - 0.5x2 - x1 研究一个逻辑单元的多项式形式对了解大脑工作十分有意义，于是</div>
<div>小 M 决定帮 H 教授 把测量出的逻辑关系表全部转换成多项式的形式。这么简单的工作一定难不倒编程能手</div>
<div>小M 的吧？&nbsp;</div></p><hr/><h3>输入格式</h3><p><p>第一行是n (1 &le; n &le; 20)，接下来共2^n行，每一行是一组逻辑输入和一个对应值，代表 x1 &hellip;xn的符号</p>
<div>
<div>以及对应的r。详见样例。数据保证所有逻辑值的绝对值不超过100，且不包 含超过 2 位小数。保证所有逻</div>
<div>辑的输入串都互不相同。&nbsp;</div>
</div></p><hr/><h3>输出格式</h3><p><p>最多2^N行，代表多项式每一项的系数，如果答案为整数，输出整数形式。</p>
<div>
<div>否则输出最简 分数形式。如果系数恰好为 0，则省略整行。</div>
<div>变量和系数用空格隔开，常数项不用加空格。&nbsp;</div>
<div>顺序按多项式的字典序：</div>
<div>常数项优先；</div>
<div>没有常数项时，最小x下标更小的项优先</div>
<div>当两项含有相同最小下标时，按除掉最小下标x以后，</div>
<div>以同样规则递归比较。</div>
<div>&nbsp;例： 1,x1,x1x2,x1x2x3,x1x3,x2,x2x3,x3 详见样例。&nbsp;</div>
</div></p><hr/><h3>样例输入</h3><pre>#1

2 
++ 0 
+- 1 
-+ 2 
-- 3  


#2

3 
--- -1.0 
-++ -1.0 
+-+ -1.0 
++- -1.0 
--+ 1.0 
-+- 1.0 
+-- 1.0 
+++ 1.0  </pre><hr/><h3>样例输出</h3><pre>#1

3/2
-1 x1 
-1/2 x2

#2

1 x1x2x3</pre><hr/><h3>提示</h3><p><p>&nbsp;对于 100%的数据， 1 &le;N&le; 20, |r| &le; 100, 100r&isin; Z.&nbsp;</p>
<div>请注意输入输出的效率。&nbsp;</div>
<div></div></p><hr/><h3>题目来源</h3><p>鸣谢佚名上传</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=3614" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=3614" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>